class Person {
  private _username: string
  constructor(name: string) {
    console.log('父类的构造方法被调用');
    // 给_username赋值
    this._username = name
  }
  speak() {
    console.log('你好');
  }
  public get name() {
    return this._username
  }
  public set name(v: string) {
    this._username = v
  }
}

class Teacher extends Person {
  constructor(name: string) {
    super(name)
    super.speak()
  }
  run() {
    console.log('老师run');

  }
  getUsername() {
    return this.name
  }
}

let t = new Teacher('jack')
console.log(t.name);
console.log(t.getUsername());
console.log(t.name);
t.name = '张三'
console.log(t);



interface IPeople {
  username: string
  age: number
  sayHi: () => void
}
interface IHuman {
  run: () => void
}

// 类实现接口 是必须要 实现接口中定义好的属性的
class Stu implements IPeople, IHuman {
  username: string = 'jack'
  age: number = 12
  sayHi() {
    console.log('hello');
  }
  run() {
    console.log('学生run', Stu.school);
  }
  // 静态属性 只能通过类名访问
  protected static school: string = 'itcast'
}
// console.log(Stu.school);


let s = new Stu()

t.run()
s.run()




export {}
